using MicroMsg.Manager;
using MicroMsg.Storage;
using MicroMsg.UI.UserContrl;
using MicroMsg.UI.Util;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.Page
{
	public class ChatroomAtMemberList : BasePage
	{
		private DelegateGetContact mGetContactCallBack;
		private List<Contact> conList;
		public ObservableCollection<Contact> itemSource;
		internal Grid LayoutRoot;
		internal StackPanel LayoutContent;
		internal panelTitle2Line panelTitle;
		internal Grid listView;
		internal ListBox MemberList;
		private bool _contentLoaded;
		public ChatroomAtMemberList()
		{
			this.InitializeComponent();
			base.add_Loaded(new RoutedEventHandler(this.ChatroomAtMemberList_Loaded));
		}
		private void ChatroomAtMemberList_Loaded(object sender, RoutedEventArgs e)
		{
			this.itemSource = new ObservableCollection<Contact>(this.conList);
			this.MemberList.set_ItemsSource(this.itemSource);
		}
		protected override void OnPageIn(object[] object_0)
		{
			if (object_0 != null && object_0.Length == 2)
			{
				if (object_0[0] != null && object_0[0] is DelegateGetContact)
				{
					this.mGetContactCallBack = (object_0[0] as DelegateGetContact);
				}
				if (object_0[1] != null && object_0[1] is List<Contact>)
				{
					this.conList = (object_0[1] as List<Contact>);
					for (int i = this.conList.get_Count() - 1; i >= 0; i--)
					{
						if (this.conList.get_Item(i).strUsrName == AccountMgr.curUserName)
						{
							this.conList.RemoveAt(i);
						}
					}
				}
			}
		}
		protected override void OnPageOut()
		{
		}
		private void ChatroomMemberItem_ItemClick(object sender, object object_0)
		{
			if (this.mGetContactCallBack != null)
			{
				base.GoBack();
				ChatroomMemberItem chatroomMemberItem = sender as ChatroomMemberItem;
				if (chatroomMemberItem != null)
				{
					this.mGetContactCallBack(chatroomMemberItem.ItemObject);
				}
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/UI/Chat/ChatRoom/ChatroomAtMemberList.xaml", 2));
			this.LayoutRoot = (Grid)base.FindName("LayoutRoot");
			this.LayoutContent = (StackPanel)base.FindName("LayoutContent");
			this.panelTitle = (panelTitle2Line)base.FindName("panelTitle");
			this.listView = (Grid)base.FindName("listView");
			this.MemberList = (ListBox)base.FindName("MemberList");
		}
	}
}
